package nxu.it.service.impl;

import jakarta.inject.Singleton;
import nxu.it.service.GreetingService;

@Singleton
public class GreetingServiceImpl implements GreetingService {
    @Override
    public String sayHello(String username,String gender) {
        String str = "你好，";
        //或者判断长度 username  !username.equals("")
        if (username != null&&username.length()>0) {
            str += username;
        } else {
            str += "无名氏";
        }
        if (gender.equals("1")) {
            str += "先生";
        } else {
            str += "女士";
        }
        return str;
    }

    public String login(String username,String password) {
        if(username.equals(password)){
            return "登录成功";
        }
        return "登录失败";
    }
}
